<?php   if(!defined('DEDEINC')) exit("Request Error!");

/**
 * 动态模板shouchulist标签
 * 会员出售过的列表模板
 *
 */
function plus_shouchulist(&$atts,&$refObj,&$fields)
{
    global $dsql,$_vars,$cfg_phpurl,$cfg_cmsurl;

    $attlist = "titlelen=30,infolen=200,row=6";
    FillAtts($atts,$attlist);
    FillFields($atts,$fields,$refObj);
    extract($atts, EXTR_OVERWRITE);
    $mid = $_vars['mid'];

    $query = "SELECT h.*,s.*,d.* FROM `#@__member_dows` h 
			  LEFT JOIN `#@__addonsoft` s ON s.aid = h.aid
			  LEFT JOIN `#@__archives` d ON d.id = h.aid
			  WHERE  h.umid='$mid' ORDER BY h.addtime DESC LIMIT 0,$row";

    $dsql->SetQuery($query);
    $dsql->Execute("al");
    $rearr = array();
    while($row = $dsql->GetArray("al"))
    {
        $row['arcurl'] = $cfg_phpurl."/view.php?aid=".$row['aid'];
        if($row['litpic']=='')
        {
            $row['litpic'] = $cfg_cmsurl.'/images/defaultpic.gif';
        }
        $rearr[] = $row;
    }
    $dsql->FreeResult("al");
    return $rearr;
}